package com.itheima.jobs;

import com.itheima.dao.ClearOrderMapper;
import com.itheima.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

public class ClearOldOrderSettingsJob {
    @Autowired
    private ClearOrderMapper clearOrderMapper;

    public void clearOldOrderSettings() throws Exception {
        try {
            String dateStr = DateUtils.parseDate2String(new Date());
            clearOrderMapper.deleteOldOrderSettings(dateStr);
            System.out.println("清理老旧预约设置成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("清理老旧预约设置失败");
        }
    }
}
